package com.bes.aiProject.config;

import com.bes.aiProject.service.AnomalyCheckService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalDateTime;

@Slf4j
@Configuration
public class ScheduledConfig {
    @Autowired
    private AnomalyCheckService anomalyCheckService;

    @Scheduled(cron = "${task.anomaly-corn:0 0 1 * * ? }")
    public void scheduled() {
        LocalDateTime currentTime = LocalDateTime.now();
        System.out.println("<<....................anomalyCheckService start..................>>");
        anomalyCheckService.AnomalyCheck(currentTime);
        System.out.println("<<....................anomalyCheckService end..................>>");

    }

}
